package com.ooo.ttt.demo


import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.ooo.ttt.demo.databinding.ActivityMainBinding
import com.ooo.ttt.demo.sample1.SurfaceActivity
import com.ooo.ttt.demo.utils.Constant.DIR_PARTH
import com.ooo.ttt.opencvlib.utils.FileUtil
import com.ooo.ttt.opencvlib.utils.PermissionTool
import java.io.File

class MainActivity : AppCompatActivity() {

    private lateinit var binding: ActivityMainBinding


    private val activity: MainActivity by lazy {
        this@MainActivity
    }




    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)
        PermissionTool.Request(this)

        val dir = File(DIR_PARTH)
        if (!dir.exists()) {
            dir.mkdirs()
        }
        FileUtil.getInstance(activity).copyAssetsToSD("lbpcascade_frontalface.xml", "face/lbpcascade_frontalface.xml")
            .setFileOperateCallback(object : FileUtil.FileOperateCallback {
                override fun onSuccess() {

                }

                override fun onFailed(error: String?) {
                }
            })

        binding.btn1.setOnClickListener {
            val intent = Intent(activity, SurfaceActivity::class.java)
            startActivity(intent)
        }


    }


}